<?php

use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Admin\ShortController;
use App\Http\Controllers\Admin\LoginController;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get("/s/{short_id}", [ShortController::class, "shortHtml"]);

Route::group(["prefix" => "admin"], function() {
    Route::get("login", [LoginController::class,"login"])->name("login");
    Route::post("login", [LoginController::class,"loginSubmit"]);

    Route::group(["middleware" => ["web", "auth"]], function () {
        Route::get("master",[MasterController::class,"master"]);
        Route::get("index", [AlipayController::class,"miniList"]);
        Route::group(["prefix" => "user"], function() {
            Route::get("logout", [UserController::class,"logout"]);
            Route::get("profile", [UserController::class,"profile"]);
            Route::post("profile", [UserController::class,"profileSubmit"]);
            Route::get("password", [UserController::class,"password"]);
            Route::post("password", [UserController::class,"passwordSubmit"]);
        });

        Route::group(["prefix" => "order"], function() {
            Route::get("list", [OrderController::class,"orderList"]);
            Route::get("product", [OrderController::class,"orderProduct"]);
            Route::get("pay", [OrderController::class,"orderPay"]);
            Route::post("pay", [OrderController::class,"orderPaySubmit"]);
            Route::get("wechat_pay_status", [OrderController::class,"wechatPayStatus"]);
            Route::any('alipayBack', [OrderController::class,'alipayBack']);
        });

        Route::group(["prefix" => "short"], function() {
            Route::get("list", [ShortController::class,"shortList"]);
            Route::get("short_add", [ShortController::class,"shortAdd"]);
            Route::get("short_update/{short_id}", [ShortController::class,"shortUpdate"]);
            Route::get("detial/{short_id}", [ShortController::class,"shortDetial"]);
        });

        Route::group(["prefix" => "manage"], function() {
            Route::get("user_list", [ShortController::class,"userList"]);
            Route::get("short_list", [ShortController::class,"allShortList"]);
            Route::get("member_list", [ShortController::class,"memberList"]);
            Route::get("user_disable", [ShortController::class,"userDisable"]);
        });
    });
});

